package com.leo.app.input;

import javafx.scene.input.MouseButton;

/**
 * @ClassName Mouse
 * @Description
 * @Author wangss
 * @date 2020.12.10 11:47
 * @Version 1.0
 */
public enum Mouse {

    LEFT(MouseButton.PRIMARY),
    MIDDLE(MouseButton.MIDDLE),
    RIGHT(MouseButton.SECONDARY);

    private final MouseButton button;

    Mouse(MouseButton button) {
        this.button = button;
    }

    public MouseButton getButton() {
        return button;
    }

    public static Mouse find(MouseButton mouseButton) {
        for (Mouse m : Mouse.values()) {
            if (null != m.button && m.button == mouseButton) {
                return m;
            }
        }
        return null;
    }
}
